package pl.perseus.action;

import lombok.Getter;
import lombok.Setter;

import org.springframework.beans.factory.annotation.Autowired;

import pl.perseus.model.Student;
import pl.perseus.service.student.IStudentService;

public class AddStudentAction extends BaseAction {

	@Getter
	@Setter
	private Student student;
	
	@Autowired 
	IStudentService service;
	
	@Override
	public String execute() {
		this.student.setActive(true);
		service.insertStudent(student);
		logAction("Adding student " + student.getFirstname()+" "+student.getSurname());
		return BaseAction.SUCCESS;
	}

}
